Skip to content

Conversation

@YousefED
Copy link
Collaborator

@YousefED YousefED commented Oct 16, 2025

Summary

Clean types and Partial / full block concepts

Rationale

#2089 (review)

Changes

  • Removes a lot of uses of PartialBlock internally, where it's not necessary
  • Cleans up some of the internal types by removing / not exporting types

Impact

Testing

Should mostly be covered by existing unit tests

  • Manual testing still needed

Screenshots/Video

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

TODO:

  • manual testing

Follow up:

  • clean more of blockToNode (there's logic there that handles partial content / blocks which is not needed anymore)
  • potentially, we could move the definition of Block and Partial lock to Zod as well, and use a transformer to distinguish between input and output types

@vercel
Copy link

vercel bot commented Oct 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
blocknote Ready Ready Preview Oct 29, 2025 3:22pm
blocknote-website Error Error Oct 29, 2025 3:22pm

* @returns an {@link OccupancyGrid}
*/
export function getTableCellOccupancyGrid(
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stopped exporting BlockFromConfigNoChildren so we have more consistency in the codebase

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are cleaning up types, I believe that:

BlockFromConfig<DefaultBlockSchema["table"], any, any>

Should only be:

BlockFromConfig<DefaultBlockSchema["table"]>

Most of the time we don't care about the other parameters, and have to remove their defaults with any. This goes for most instances of B, I, S

*/
public blocksToHTMLLossy(
blocks: PartialBlock<BSchema, ISchema, SSchema>[] = this.document,
blocks: Block<BSchema, ISchema, SSchema>[] = this.document,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking API change, should be documented in PR / release notes

}

// Hide handles if the table block has been removed.
this.state.block = this.editor.getBlock(this.state.block.id)!;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: In the old version we were potentially setting this.state.block to undefined. Now, it will keep the old (unavailable block). can this break anything?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't clear to me why this was modified, but it certainly is a change in behavior that would need to be validated

@YousefED YousefED changed the title refactor types and partial / full refactor: less use of PartialBlocks and type cleanup Oct 16, 2025
* @returns an {@link OccupancyGrid}
*/
export function getTableCellOccupancyGrid(
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are cleaning up types, I believe that:

BlockFromConfig<DefaultBlockSchema["table"], any, any>

Should only be:

BlockFromConfig<DefaultBlockSchema["table"]>

Most of the time we don't care about the other parameters, and have to remove their defaults with any. This goes for most instances of B, I, S

}

// Hide handles if the table block has been removed.
this.state.block = this.editor.getBlock(this.state.block.id)!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't clear to me why this was modified, but it certainly is a change in behavior that would need to be validated

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@2111

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@2111

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@2111

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@2111

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@2111

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@2111

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@2111

@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@2111

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@2111

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-email-exporter@2111

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@2111

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@2111

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@2111

commit: 2cfa627

@YousefED YousefED merged commit fab647f into refactor/zod-props-v2 Oct 29, 2025
2 of 10 checks passed
@YousefED YousefED deleted the refactor/remove-partials branch October 29, 2025 15:16
@YousefED YousefED mentioned this pull request Oct 29, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants